package com.example.stretching;

//import com.google.android.gcm.GCMRegistrar;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

import android.app.TabActivity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.gcm.GoogleCloudMessaging;
    /**
     * 첫번쨰 페이지 - 탭호스트
     * 1.부분별 스트레칭 정보
     * 2.스케쥴
     * 3.내 운동정보 확인
     * 프로그램 내에서 페이지 넘어갈 때 탭호스트도 같이 넘어갈 수 있게끔 수정해야함ㅠ
     * @author DS
     */
	
	public class tabMainActivity extends TabActivity {
	static TabHost tabHost; 
	Intent intent;
	static long time_tab;
	public static boolean complete = false;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		
		Log.d("time_tab", Integer.toString((int) System.currentTimeMillis()));

//		if(complete = true){
//		Intent intent0 = getIntent();
//		String aa = intent0.getStringExtra("current_time");
//		Log.d("aa", aa);
//		Intent intent9 = new Intent(tabMainActivity.this, modifyScheduleActivity.class);
//		intent9.putExtra("current_time2", aa);
//		startActivity(intent9);
//		finish();};
		
		
//		if (checkPlayServices()) {
//			gcm = GoogleCloudMessaging.getInstance(this);
//			regid = getRegistrationId(context);
////			mDisplay.setText(regid);
//			if (regid.isEmpty()) {
//				new RegisterBackground().execute();
//			}
//
//		}
//		tabHost = getTabHost();
//			 requestWindowFeature(Window.FEATURE_NO_TITLE);
	        
		    
			// custom title bar
//			    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
				setContentView(R.layout.include_tab_main);
				
//			    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
//			main_back = (ImageView)findViewById(R.drawable.main_back);

        tabHost = (TabHost) findViewById(android.R.id.tabhost);
        tabHost.setup(getLocalActivityManager()); 

		    TabSpec ts1 = tabHost.newTabSpec("HealthCare");
		    ts1.setIndicator("HealthCare");
		    ts1.setContent(new Intent(this, AboutStretching.class));
		    tabHost.addTab(ts1);
		    
		    TabSpec ts2 = tabHost.newTabSpec("WorkingTime");
		    ts2.setContent(new Intent(this, RealMainActivity.class));
		    ts2.setIndicator("WorkingTime");
		    tabHost.addTab(ts2);

		    TabSpec ts3 = tabHost.newTabSpec("Stretching");
		    ts3.setContent(new Intent(this, InfoTabActivity.class));
		    ts3.setIndicator("Stretching");
		    tabHost.addTab(ts3);
		    
		    tabHost.setCurrentTab(0);
		   
	


	}

	
	
//	public void registerGcm() {
//		 
//		GCMRegistrar.checkDevice(this);
//		GCMRegistrar.checkManifest(this);
//		 
//		final String regId = GCMRegistrar.getRegistrationId(this);
//		 
//		if (regId.equals("")) {
//		GCMRegistrar.register(this, "프로젝트 ID" );
//		} else {
//		Log.e("id", regId);
//		}
//		 
//		}
	}
